package com.ricky.chat.common.coder;

import com.ricky.chat.common.dto.JsonMsgDto;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import java.util.List;

/**
 * @Auther：ricky
 * @Date: 2025-10-02 10:16
 * @Description
 */
public class JsonMsgEncoder extends MessageToMessageEncoder<Object> {

    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, Object obj, List<Object> list) {
        String json = JsonMsgDto.format(obj);
        System.out.println("发送报文：" + json);
        list.add(json);
    }
}
